package Niuke;


import com.sun.xml.internal.ws.addressing.WsaTubeHelperImpl;

import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;

public class oppo {

    public int maxDigit (int[] digits) {
        // write code here
        Arrays.sort(digits);
        int res=0;
        for (int i=digits.length-1;i>=0;i--){
            res=res*10+digits[i];
        }
        return res;
    }


      public class ListNode {
        int val;
        ListNode next = null;
        public ListNode(int val) {
          this.val = val;
        }
      }



    public ListNode combineTwoDisorderNodeToOrder (ListNode node1, ListNode node2) {
        // write code here
        PriorityQueue<ListNode> priorityQueue=new PriorityQueue<>((n1,n2)->{
            return n1.val-n2.val;
        });
        ListNode ptr1=node1;
        while (ptr1!=null){
            priorityQueue.add(ptr1);
            ListNode tmp=ptr1;
            ptr1=ptr1.next;
            tmp.next=null;
        }
        ListNode ptr2=node2;
        while (ptr2!=null){
            priorityQueue.add(ptr2);
            ListNode tmp=ptr2;
            ptr2=ptr2.next;
            tmp.next=null;
        }
        ListNode dummy=new ListNode(-1);
        ListNode ptrr=dummy;
        while (!priorityQueue.isEmpty()){
            ListNode poll = priorityQueue.poll();
            ptrr.next=poll;
            ptrr=ptrr.next;
        }
        return dummy.next;
    }


    public long tourismRoutePlanning (int scenicspot) {
        // write code here
        long[] res=new long[scenicspot];
        res[0]=1;
        res[1]=2;
        for (int i=2;i<scenicspot;i++){
            res[i]=res[i-1]+res[i-2];
        }
        return res[scenicspot-1];
    }

    public static void main(String[] args) {
        int i = new oppo().maxDigit(new int[]{3, 4});
        System.out.println(i);
    }
}
